def solve(num: int, k: int):
    l = []
    while num > 0:
        l.insert(0, num % k)
        num //= k
    score = 0
    for i in l:
        score += i
    return score
count = 0
for i in range(1, 2025):
    if solve(i, 2) == solve(i, 4):
        count += 1
print(count)
